import React, { useContext, useReducer, useEffect, useCallback } from 'react';

import style from './index.module.scss'
import HomeContent from '@/components/hookComponents/content';
import NavBar from '@/components/hookComponents/navbar/NavBar';
import RsaUtil, { decryptData } from '@/utils/rsa/RsaUtil';
import { encryptByPrivateKey, decryptByPublicKey, decryptByPublicKey2, generator, decodeMessage } from '@/utils/rsa/YohoRsa';
import JSEncrypt from 'jsencrypt';
interface Iprops { }
function Home(props: Iprops) {

  const data = "l2eKpJeIjqk8U5T04zsj/aJtDclU5Sxvbrg4j+Vm/f9P8vjzO/nU1lyO6NqMmv/TmqmF8Jjm88nrxUgZaAI4KzaApaWdceRME+QABWNfTHzN0JH+WO43I0IMgupLuv5Jc1JA/03rDDyPWbd5tnKY87CysOCOmpTDO4/Z1+eDGjJ3zxQnufBRv+dGrjsgzIQR9LQRYmDEFXlslAABPQEXU0R9bzPxSIOdqmR36Uf73dzS+I20d7vPaBMCV2+WHHi+wyv0/GjWbNV8yKbdE/aUcSEtRg606tkuxiOGdEODmMGfzmWQDC62eE3sSR/CFbkg/405HaZxvpSAPQuOwHj9xvH7j8ZKlXUbka6YivlIRXhkIC6zxY82JpDWpN8HQSNhXvk2LY1uzXyaMVnWSFRigDNQeQJY+U+Dtd55G7MLaE9esDz3MDoIEilxknp0lE5DDARodYeBqMXnHqgAtEcOV6SI23q9uKX7fPN1MXZJ+Y+OciZpvaf8sF3r3Jhsx8spxyhqmkgBz5vVEBEywcycNvuADHzl5kXRn6dvLs525LdXi92Dj3IcVHE44c5qM7qCokSOlB9Knuhspw+T0UldI9c6ZhwTdbDE+AsRY2p0Zjs0Si5J9Xh92NSspgCHAMiXvHpkjTRoZQs09uQHFjX1sjbcBSAhwj/cyPK4sUUUh70=";
  const jsonData = { "airdropAmount": "20000000000000000000000000", "nonce": 0, "signContent": "0xf7f74c3d47e42cbed08c7c8a7cb0e64cf476557b22f2ba0aa39c90271429452a528bee527a2051b8efdeab1ca170c6e187868b815a7e429cb1a1beb9c0347d8c1b", "signId": 4341, "signValidTime": 1706763870, "tokenAddress": "0x2fC0eBefDD68134809Ee359BBC8A5576c3788120", "userAddress": "0xdDbdaEb812E6090961bb87f983368502FCD902D3" }
  // const publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0rNTyn8c0wEEpx942SsK2EgCPrrq02EuaFiCXK7DAQyQ6zu34ue80gWIStgihjYHcXOZQkLuQzuB6ZOxGRcA3RuAodZBTmi/EwHB2IGeLbbnTQcVxAgO37qCcWa2vzAKs7PaMTFlfqWDllExg/8n4Ei4i2dv82MVewoo9v0ufuwV0E1JCu3nWRsfGx9cDq6nBLkassJKJklI8Vl4gfuPGmU/aYYjHrJrXJc16eP7C1lsQLkXd4MsfMYvujggkz9pDiR7FTlEFhCo4osqIfeZF0f4G4eeEOkVeNEYWXShKdGYQU4yCrE3vc/ktasoRGPi9xcGF08ItT6BqGBUwLSWnQIDAQAB";

  const publicKey = `MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0/uknR528RGLhrleAX2D
  RsHFcdJp1MSSVRtl/Q7/+p/1fSt0o4ik5zHlYOQNsT18CIuoKYxExmYiZIGL8VIU
  xa3MhU6FDqsB/i9j/BuNJd2tbnlMw7IGbHgl8GAM6zKCe5IRhQqT7geLycN/+vCg
  fiBPDuzxsWWLl1Qhbn6pW1Yg41Sly6opxav8RzSGcAQXLFOAM6GNrl8ao5yM2ET9
  UDOJ0rbC3eWdXIZsUh8Jse88YzDSO+XG6jmbzObKqI8UkwFUrAUzjKfTIF3XMZJ5
  1ZNODaYx5fJkKSgDQLDSbV/JyErvIxIBQvbDzg2pKEeUvTz2Pds1d+2BiVb16B9n
  pXdJhMeGXv4vBEKlfCKlvrdY7Rutam17OUbvjskhUI3nsxnUyMdLawHaFJgBEH79
  VLCBiYEQR2ETIZ/eTvqVIHGrk4ZzCun7wU+nLJGYlBWF/JlEoWGBYQen+MIwhUAv
  r64ib3d+zpsWigYGngEJO27mXTOih2IrKEw3S8R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baCja6ahamfaKqMa0z
  mReVKTI7tViGEwt8ceo3fncVq5YSmajGLFQ5Cvim84Nq9vT5qphUtz13INr0uZYB
  udVpZx/tkj6S42STbZX7jkaKirhVedZ8LElvkU+fqhAjwDGp93ZhdDrv+4QBeSaD
  cRI/CRlpEnXnKdt16XhyWCiYJ7ar33A8be10zCR+jtackX4vX0R0iwfN2IAOXoW2
  nbHnRlQALV+PKPA9hSgussfSoKXszPXC`


  const publickey2 = `MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEArsuIR7/mledO1RybZPBY
KTnlmfolavHPPqF1ju9prcg1DMcgzn7M3JZ78lfllMZs478RinjbOoZty5EbwRw1
1kp0RV2g5SmfX/HvFlp5B5ZCejaukZHuHtR7rvLafV0MnIl64JzvFoOM7XgL8pv8
V8IWFfPToODoZwU+GjAheaAXyshjkCNcqT7zp6+urwUUwh5EKACjE25tpx5U/foi
4nrs1NJGjcrR0RQhWkz/bmvFMHPJHEyI/e/6bJh6etKGXjnQErkHoNdf+0+cYBgF
yMbvPXh5Ysga9lfS6RfezyNMSJKJM30a2ryJXxiSbkIiWamNKkEfvj/iCrAmc/rL
aLR/BdW+p0rwdX1HJbHX0sFgmrOponqzjZSjEIWx80ZrL/RNK6mabDCLbQHTnGKx
qyraD5EQAWiiUwT/ZKKjldQsl4RgCfRyQMRja1ogfk8wHnrP+m9dSZ1p+1gxHGWb
Ou4xffji7CR3GrVnOhw1KOVeVshFPwAf+DxgOeyYnYRhNhimpGaxihH0C0PLJXW4
XWWtSrZ+BukGgl8fTqNHR+CnScCi2lhjKE7IQT3G55QCzGVgPG2PycmONHcEUUFz
0MD90+PkVMLlolV/iq+dnxCp+DCS26u+p1FZun+NjK1nCIYI9uq6W3P5UOx1cSY6
Gk44b8UAjfCl7YeUI9GdHpUCAwEAAQ==`

  const privateKey2 = `MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCuy4hHv+aV507V
  HJtk8FgpOeWZ+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YwLJD7LRIfaDJ
  WjMIao2oaDOF4c+xnFdAR/Xv1j2g1C8saS/2YoDRQP8MvGfwlwekTqBlJacCYVTl
  UgLkNEB8/oTJZETjTiDA44e+bTO+318CGfLtQIDoh3zRJCPzg9SiPBjR/QgTGk7G
  jCOI8E6ZYUvUydDoED2NmghqcqnDZLw3miETQ/yxtoeqYwckA3nl5nZiY+hTZIli
  qf2Z5+P+nJNEU1LftNYYV+XEOaXweDWFDMjwCi85nn+/K6F94x0UnniDE48LFWCL
  KBBjRgUUQkCyHjlHw50GPaLoUBRpiWDmLp/5SqiBAoIBADJPsbMA3LBHS5YVLx8t
  T89TVYRbOIdxZ4zdak9/BJu80BCasx1/u6tBFeaiBEki762Or3BgCk562X9m5MEY
  zZoRiLDp1bAxv6hUzhCo/vF0t3O4s3BbZoYS+CUHQU0RzRGejJ0ytffL6wnPMlpt
  SsqGJ8GcjxwkmP0a4Ywz6DiOx9z/0wLEMWdfywDKmTUdRZtWV43gn3N9mR9iNcT+
  z0Zkozk7Oup1e6+M09CRxIUfPtHdIyGLdONr+TgEd4SrWa+tk1Djie2bv3WSHc9u
  U7EFn3cndjH5/v0baXhBm44FyILttY2lFWaDQgOXSovm10DcMOYPuvzj9T7RZlST
  LkkCggEAKMRNE0Zcfbj6kleKjQhMLkqBRjw140Li7KAvEiEshSlt5By8QaWJbAcB
  /UHkP/cStbO+RaYvVTgp0BFbQAJTfq7bQY2X8lLmPYOjHGCgBkeKCsBlSWIuULF4
  dfvem2YSyz5DUY/9fT8+iP5kkTliKugrn8NAKa8nqV6LRTTaXyuDZjGzdwdQYLh8
  bFqvyiG8FaziibVCiIK25mQzeXDcGDpXG1ePc5jj0S7GWvpJSo1ZFvkQSafKOthd
  HlbKpabk274YfbAIWqvmqptN790KA4ZviP8aW3kqPeRcrHlGqpjnPvmYXNVrGYiy
  z2HEtoQaUAY5m2s9CNMqdD9YkoiVyg==`
  const publicEn = new JSEncrypt();
  // 生成密钥对
  publicEn.getKey();
  // 获取公钥
  //const publicKey = publicEn.getPublicKey();
  // 获取私钥
  //const privateKey = publicEn.getPrivateKey();

  //公钥对象
  const jSEncrypt = new JSEncrypt()

  jSEncrypt.setPublicKey(publickey2)
  // const jsonTestData = { "airdropAmount2": "20000000000000000000000000" }

  // const enData = (jSEncrypt as any).encryptUnicodeLong(JSON.stringify(jsonData))
  // // console.log("加密内容2", enData)
  // if (enData) {
  //   // 使用示例
  //   const decrypt = new JSEncrypt()
  //   decrypt.setPrivateKey(privateKey2);
  //   console.log("decrypt",decrypt)
  //   const deData = (decrypt as any).decryptUnicodeLong(enData)
  //   console.log("deData2", deData)
  // }
  const decrypt = new JSEncrypt()
  decrypt.setPrivateKey(privateKey);
  const deData = decrypt.decrypt(data)
  console.log("deData2解密", deData)
  // console.log("私钥加密jsonData", encryptedData);
  // const deData = decryptByPublicKey2(encryptedData)
  console.log("私钥解密结果", deData)

  // 使用示例
  return (
    <div className={style.container}>
      <div className={style.homeContent}>
        <HomeContent />
      </div>
    </div>
  );
}
export default Home;
